﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace iLangl.Customer.DAL
{
	public class DALFacade : IDALFacade
	{
		#region Singelton
		IDALFacade _dalfacade;
		private DALFacade(IDALFacade dalfacade)
		{
			_dalfacade = dalfacade;
		}

		private static DALFacade instance;
		private static object mutex = new object();
		/// <summary>
		/// The instance of the DALFacade.
		/// </summary>
		public static DALFacade Instance
		{
			get
			{
				if (instance == null)
				{
					lock (mutex)
					{
						if (instance == null)
						{
							IDALFacade dalfacade = null;

							if( DALFacadeConfiguration.Instance.StorageType == "XML")
							{
								dalfacade = new iLangl.Customer.DAL.XMLStorage.XMLDALFacade();
							}
							instance = new DALFacade(dalfacade);
						}
					}
				}
				return instance;
			}
		}

		#endregion

		#region IDALFacade Members

		public ICompanyDAL CompanyDAL
		{
			get { return _dalfacade.CompanyDAL; }
		}


		public IProjectDAL ProjectDAL
		{
			get { return _dalfacade.ProjectDAL; }
		}

		public IWorkAreaDAL WorkAreaDAL
		{
			get { return _dalfacade.WorkAreaDAL; }
		}

		public IProductDAL ProductDAL
		{
			get { return _dalfacade.ProductDAL; }
		}



		public IContentDAL ContentDAL
		{
			get { return _dalfacade.ContentDAL; }
		}

		public ITranslationDAL TranslationDAL
		{
			get { return _dalfacade.TranslationDAL; }
		}

		public ISecurityDAL SecurityDAL
		{
			get { return _dalfacade.SecurityDAL; }
		}

		public IContactDAL ContactDAL
		{
			get { return _dalfacade.ContactDAL; }
		}

		
		public IConfigurationDAL ConfigurationDAL
		{
			get { return _dalfacade.ConfigurationDAL; }
		}


		public ISettingsDAL SettingsDAL
		{
			get { return _dalfacade.SettingsDAL; }
		}
	

		public IAlertDAL AlertDAL
		{
			get { return _dalfacade.AlertDAL; }
		}

		#endregion
	}
}
